package com.leyou.user.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.leyou.common.exceptions.LyException;
import com.leyou.common.utils.RegexUtils;
import com.leyou.user.dto.UserDTO;
import com.leyou.user.dto.UserDetailDTO;
import com.leyou.user.entity.User;
import com.leyou.user.entity.UserAddress;
import com.leyou.user.entity.UserDetail;
import com.leyou.user.mapper.UserAddressMapper;
import com.leyou.user.mapper.UserMapper;
import com.leyou.user.service.UserAddressService;
import com.leyou.user.service.UserDetailService;
import com.leyou.user.service.UserService;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.RandomStringUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;

import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.TimeUnit;

import static com.leyou.common.constants.MQConstants.ExchangeConstants.SMS_EXCHANGE_NAME;
import static com.leyou.common.constants.MQConstants.RoutingKeyConstants.VERIFY_CODE_KEY;

/**
 * @author 虎哥
 */
@Service
public class UserAddressServiceImpl extends ServiceImpl<UserAddressMapper, UserAddress> implements UserAddressService {

    private final AmqpTemplate amqpTemplate;
    private final StringRedisTemplate redisTemplate;
    private final BCryptPasswordEncoder passwordEncoder;

    public UserAddressServiceImpl(AmqpTemplate amqpTemplate, StringRedisTemplate redisTemplate, BCryptPasswordEncoder passwordEncoder) {
        this.amqpTemplate = amqpTemplate;
        this.redisTemplate = redisTemplate;
        this.passwordEncoder = passwordEncoder;
    }

}